package com.hmall.item.synchronization;

import com.hmall.item.service.impl.ItemService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HotelListener {

    @Autowired
    private ItemService itemService;

    /**
     * 监听新的业务
     * @param id 酒店id
     */
    @RabbitListener(queues = MqConstants.ITEM_INSERT_QUEUE)
    public void listenHotelInsertOrUpdate(Long id){
        itemService.insertById(id);
    }

    /**
     * 监听删除的业务
     * @param id 酒店id
     */
    @RabbitListener(queues = MqConstants.ITEM_DELETE_QUEUE)
    public void listenHotelDelete(Long id){

    }
}
